package work.linruchang.mybatisplussamplestest.config.mybatisplus.typeHandler;

import cn.hutool.core.lang.TypeReference;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import work.linruchang.mybatisplussamplestest.bean.param.Wallet;

import java.util.List;

/**
 * 作用：
 *
 * @author LinRuChang
 * @version 1.0
 * @date 2022/06/15
 * @since 1.8
 **/
@Slf4j
@MappedTypes({Object.class})
@MappedJdbcTypes(JdbcType.VARCHAR)
public class WalletListTypeHandler extends HutooljsonTypeHandler {


    public WalletListTypeHandler(Class<?> type) {
        super(type);
    }

    @Override
    protected Object parse(String json) {
        return JSONUtil.toBean(json, new TypeReference<List<Wallet>>() {
        },true);
    }
}
